<?php
/*
include_once (dirname(__FILE__)."/../../includePaths.php");
require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();


$ingres_config = array(
    'host'     => 'kpl',
    'username' => 'kpl',
    'password' => 'kpl',
	'dbname'   => 'kpl',
	'adapterNamespace' => 'Kpl_Db_Adapter'
);

$db = Zend_Db::factory('Ingres', $ingres_config);

//$res = $db->fetchAll("SELECT * FROM m01");


Zend_Db_Table::setDefaultAdapter($db);




$menu = new Menu;
$select = $menu->select();
$select->where('id = ?',40);
var_dump($menu->fetchAll($select));
//mdb2 way
die();


require_once("MDB2.php");

$url = 'ingres://kpl:kpl@kpl/kpl';
$con = MDB2::factory($url);
//var_dump($con);
$sql = "select * from m01 where dir like '%ps%'";
$resultset = $con->query($sql);

 

if(PEAR::isError($resultset)) {
    die('Failed to issue query, error message : ' . $resultset->getMessage());
}

while($row = $resultset->fetchRow(MDB2_FETCHMODE_ASSOC)) {
    foreach($row as $field => $value) {
        echo "$field / $value \n<br/>";
    }
}

die('OK');
*/
//native way


$conn = ingres_connect ("kpl2::kpl","kpl","kpl");
if ( ingres_errno() ) {
    $error_code=ingres_errno($conn);
    $error_text=ingres_error($conn);
    $error_sqlstate=ingres_errsqlstate($conn);
    printf ( "Error during query : %s\n\r</br>",$error_code);
    printf ( "Error during query : %s\n\r</br>", $error_text);
    printf ( "Error during query : %s\n\r</br>", $error_sqlstate);
    die("i died");
}

$NumRow=32000;
//$stmt = ingres_query ("select * from bill_item where acc_n=2200008 and idate > 20040401");
//$stmt = ingres_query ("select * from m02");
//$stmt = ingres_query ("select * from m03");
//$stmt = ingres_query ("select * from ice_active_users");
//$stmt = ingres_query ($conn,"select * from m01");
$stmt = ingres_query ($conn,"select * from m01");

//$nrows = ingres_num_fields ();

$ddl = false;

while ($row = ingres_fetch_array($stmt,INGRES_ASSOC)) {
	
	var_dump($row);
	}

ingres_close($conn);

?>
